3.1.3 \(\int (c+d x)^2 \sin (a+b x) \, dx\) [3]

Optimal. Leaf size=50 \[ \frac {2 d^2 \cos (a+b x)}{b^3}-\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 d (c+d x) \sin (a+b x)}{b^2} \]

[Out]

2*d^2*cos(b*x+a)/b^3-(d*x+c)^2*cos(b*x+a)/b+2*d*(d*x+c)*sin(b*x+a)/b^2

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3377, 2718} \begin {gather*} \frac {2 d^2 \cos (a+b x)}{b^3}+\frac {2 d (c+d x) \sin (a+b x)}{b^2}-\frac {(c+d x)^2 \cos (a+b x)}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2*Sin[a + b*x],x]

[Out]

(2*d^2*Cos[a + b*x])/b^3 - ((c + d*x)^2*Cos[a + b*x])/b + (2*d*(c + d*x)*Sin[a + b*x])/b^2

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rubi steps

\begin {align*} \int (c+d x)^2 \sin (a+b x) \, dx &=-\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {(2 d) \int (c+d x) \cos (a+b x) \, dx}{b}\\ &=-\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 d (c+d x) \sin (a+b x)}{b^2}-\frac {\left (2 d^2\right ) \int \sin (a+b x) \, dx}{b^2}\\ &=\frac {2 d^2 \cos (a+b x)}{b^3}-\frac {(c+d x)^2 \cos (a+b x)}{b}+\frac {2 d (c+d x) \sin (a+b x)}{b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.10, size = 45, normalized size = 0.90 \begin {gather*} \frac {-\left (\left (-2 d^2+b^2 (c+d x)^2\right ) \cos (a+b x)\right )+2 b d (c+d x) \sin (a+b x)}{b^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)^2*Sin[a + b*x],x]

[Out]

(-((-2*d^2 + b^2*(c + d*x)^2)*Cos[a + b*x]) + 2*b*d*(c + d*x)*Sin[a + b*x])/b^3

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(147\) vs. \(2(50)=100\).
time = 0.05, size = 148, normalized size = 2.96

method result size
risch \(-\frac {\left (d^{2} x^{2} b^{2}+2 b^{2} c d x +b^{2} c^{2}-2 d^{2}\right ) \cos \left (b x +a \right )}{b^{3}}+\frac {2 d \left (d x +c \right ) \sin \left (b x +a \right )}{b^{2}}\) \(61\)
norman \(\frac {\frac {-2 b^{2} c^{2}+4 d^{2}}{b^{3}}+\frac {d^{2} x^{2} \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}-\frac {d^{2} x^{2}}{b}-\frac {2 c d x}{b}+\frac {4 c d \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b^{2}}+\frac {4 d^{2} x \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b^{2}}+\frac {2 c d x \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}}{1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )}\) \(129\)
derivativedivides \(\frac {-\frac {a^{2} d^{2} \cos \left (b x +a \right )}{b^{2}}+\frac {2 a c d \cos \left (b x +a \right )}{b}-\frac {2 a \,d^{2} \left (\sin \left (b x +a \right )-\left (b x +a \right ) \cos \left (b x +a \right )\right )}{b^{2}}-c^{2} \cos \left (b x +a \right )+\frac {2 c d \left (\sin \left (b x +a \right )-\left (b x +a \right ) \cos \left (b x +a \right )\right )}{b}+\frac {d^{2} \left (-\left (b x +a \right )^{2} \cos \left (b x +a \right )+2 \cos \left (b x +a \right )+2 \left (b x +a \right ) \sin \left (b x +a \right )\right )}{b^{2}}}{b}\) \(148\)
default \(\frac {-\frac {a^{2} d^{2} \cos \left (b x +a \right )}{b^{2}}+\frac {2 a c d \cos \left (b x +a \right )}{b}-\frac {2 a \,d^{2} \left (\sin \left (b x +a \right )-\left (b x +a \right ) \cos \left (b x +a \right )\right )}{b^{2}}-c^{2} \cos \left (b x +a \right )+\frac {2 c d \left (\sin \left (b x +a \right )-\left (b x +a \right ) \cos \left (b x +a \right )\right )}{b}+\frac {d^{2} \left (-\left (b x +a \right )^{2} \cos \left (b x +a \right )+2 \cos \left (b x +a \right )+2 \left (b x +a \right ) \sin \left (b x +a \right )\right )}{b^{2}}}{b}\) \(148\)
meijerg \(\frac {4 d^{2} \sqrt {\pi }\, \cos \left (a \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\left (-\frac {x^{2} b^{2}}{2}+1\right ) \cos \left (b x \right )}{2 \sqrt {\pi }}+\frac {x b \sin \left (b x \right )}{2 \sqrt {\pi }}\right )}{b^{3}}+\frac {4 d^{2} \sqrt {\pi }\, \sin \left (a \right ) \left (\frac {x \left (b^{2}\right )^{\frac {3}{2}} \cos \left (b x \right )}{2 \sqrt {\pi }\, b^{2}}-\frac {\left (b^{2}\right )^{\frac {3}{2}} \left (-\frac {3 x^{2} b^{2}}{2}+3\right ) \sin \left (b x \right )}{6 \sqrt {\pi }\, b^{3}}\right )}{b^{2} \sqrt {b^{2}}}+\frac {4 d c \sqrt {\pi }\, \cos \left (a \right ) \left (-\frac {x b \cos \left (b x \right )}{2 \sqrt {\pi }}+\frac {\sin \left (b x \right )}{2 \sqrt {\pi }}\right )}{b^{2}}+\frac {4 d c \sqrt {\pi }\, \sin \left (a \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (b x \right )}{2 \sqrt {\pi }}+\frac {x b \sin \left (b x \right )}{2 \sqrt {\pi }}\right )}{b^{2}}+\frac {c^{2} \sqrt {\pi }\, \cos \left (a \right ) \left (\frac {1}{\sqrt {\pi }}-\frac {\cos \left (b x \right )}{\sqrt {\pi }}\right )}{b}+\frac {c^{2} \sin \left (a \right ) \sin \left (b x \right )}{b}\) \(224\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2*sin(b*x+a),x,method=_RETURNVERBOSE)

[Out]

1/b*(-1/b^2*a^2*d^2*cos(b*x+a)+2/b*a*c*d*cos(b*x+a)-2/b^2*a*d^2*(sin(b*x+a)-(b*x+a)*cos(b*x+a))-c^2*cos(b*x+a)
+2/b*c*d*(sin(b*x+a)-(b*x+a)*cos(b*x+a))+1/b^2*d^2*(-(b*x+a)^2*cos(b*x+a)+2*cos(b*x+a)+2*(b*x+a)*sin(b*x+a)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 141 vs. \(2 (50) = 100\).
time = 0.31, size = 141, normalized size = 2.82 \begin {gather*} -\frac {c^{2} \cos \left (b x + a\right ) - \frac {2 \, a c d \cos \left (b x + a\right )}{b} + \frac {a^{2} d^{2} \cos \left (b x + a\right )}{b^{2}} + \frac {2 \, {\left ({\left (b x + a\right )} \cos \left (b x + a\right ) - \sin \left (b x + a\right )\right )} c d}{b} - \frac {2 \, {\left ({\left (b x + a\right )} \cos \left (b x + a\right ) - \sin \left (b x + a\right )\right )} a d^{2}}{b^{2}} + \frac {{\left ({\left ({\left (b x + a\right )}^{2} - 2\right )} \cos \left (b x + a\right ) - 2 \, {\left (b x + a\right )} \sin \left (b x + a\right )\right )} d^{2}}{b^{2}}}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*sin(b*x+a),x, algorithm="maxima")

[Out]

-(c^2*cos(b*x + a) - 2*a*c*d*cos(b*x + a)/b + a^2*d^2*cos(b*x + a)/b^2 + 2*((b*x + a)*cos(b*x + a) - sin(b*x +
 a))*c*d/b - 2*((b*x + a)*cos(b*x + a) - sin(b*x + a))*a*d^2/b^2 + (((b*x + a)^2 - 2)*cos(b*x + a) - 2*(b*x +
a)*sin(b*x + a))*d^2/b^2)/b

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 63, normalized size = 1.26 \begin {gather*} -\frac {{\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2} - 2 \, d^{2}\right )} \cos \left (b x + a\right ) - 2 \, {\left (b d^{2} x + b c d\right )} \sin \left (b x + a\right )}{b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*sin(b*x+a),x, algorithm="fricas")

[Out]

-((b^2*d^2*x^2 + 2*b^2*c*d*x + b^2*c^2 - 2*d^2)*cos(b*x + a) - 2*(b*d^2*x + b*c*d)*sin(b*x + a))/b^3

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 112 vs. \(2 (48) = 96\).
time = 0.14, size = 112, normalized size = 2.24 \begin {gather*} \begin {cases} - \frac {c^{2} \cos {\left (a + b x \right )}}{b} - \frac {2 c d x \cos {\left (a + b x \right )}}{b} - \frac {d^{2} x^{2} \cos {\left (a + b x \right )}}{b} + \frac {2 c d \sin {\left (a + b x \right )}}{b^{2}} + \frac {2 d^{2} x \sin {\left (a + b x \right )}}{b^{2}} + \frac {2 d^{2} \cos {\left (a + b x \right )}}{b^{3}} & \text {for}\: b \neq 0 \\\left (c^{2} x + c d x^{2} + \frac {d^{2} x^{3}}{3}\right ) \sin {\left (a \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2*sin(b*x+a),x)

[Out]

Piecewise((-c**2*cos(a + b*x)/b - 2*c*d*x*cos(a + b*x)/b - d**2*x**2*cos(a + b*x)/b + 2*c*d*sin(a + b*x)/b**2
+ 2*d**2*x*sin(a + b*x)/b**2 + 2*d**2*cos(a + b*x)/b**3, Ne(b, 0)), ((c**2*x + c*d*x**2 + d**2*x**3/3)*sin(a),
 True))

________________________________________________________________________________________

Giac [A]
time = 4.22, size = 65, normalized size = 1.30 \begin {gather*} -\frac {{\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2} - 2 \, d^{2}\right )} \cos \left (b x + a\right )}{b^{3}} + \frac {2 \, {\left (b d^{2} x + b c d\right )} \sin \left (b x + a\right )}{b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*sin(b*x+a),x, algorithm="giac")

[Out]

-(b^2*d^2*x^2 + 2*b^2*c*d*x + b^2*c^2 - 2*d^2)*cos(b*x + a)/b^3 + 2*(b*d^2*x + b*c*d)*sin(b*x + a)/b^3

________________________________________________________________________________________

Mupad [B]
time = 0.55, size = 84, normalized size = 1.68 \begin {gather*} \frac {\cos \left (a+b\,x\right )\,\left (2\,d^2-b^2\,c^2\right )}{b^3}-\frac {d^2\,x^2\,\cos \left (a+b\,x\right )}{b}+\frac {2\,c\,d\,\sin \left (a+b\,x\right )}{b^2}+\frac {2\,d^2\,x\,\sin \left (a+b\,x\right )}{b^2}-\frac {2\,c\,d\,x\,\cos \left (a+b\,x\right )}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(a + b*x)*(c + d*x)^2,x)

[Out]

(cos(a + b*x)*(2*d^2 - b^2*c^2))/b^3 - (d^2*x^2*cos(a + b*x))/b + (2*c*d*sin(a + b*x))/b^2 + (2*d^2*x*sin(a +
b*x))/b^2 - (2*c*d*x*cos(a + b*x))/b

________________________________________________________________________________________